<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
    <TargetFrameworks Condition="'$(NetCoreAppPrevious)' != ''">$(TargetFrameworks);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious)</TargetFrameworks>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <IncludePlatformAttributes>true</IncludePlatformAttributes>
    <UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
    <IsPackable>true</IsPackable>
    <AddXamarinPlaceholderFilesToPackage>true</AddXamarinPlaceholderFilesToPackage>
    <PackageDescription>Provides support for code-page based encodings, including Windows-1252, Shift-JIS, and GB2312.

Commonly Used Types:
System.Text.CodePagesEncodingProvider</PackageDescription>
  </PropertyGroup>

  <!-- Generator for code mapping table, target to invoke is GenerateEncodingSource -->
  <PropertyGroup>
    <!-- This Task can be re-run with /t:GenerateEncodingSource
         An IANA Mapping file contains rows of two elements: a valid IANA encoding identifier, and the equivalent code page.
         There may be many IANA ids (aliases) mapped to a single code page. -->
    <IANAMappingPath>Data\CodePageNameMappings.csv</IANAMappingPath>
    <!-- The preferred name file contains rows of three elements: a code page, the 'canonical' IANA identifier,
         and an "English" or descriptive name.  There is one row per code page. -->
    <PreferredIANANamesPath>Data\PreferredCodePageNames.csv</PreferredIANANamesPath>
    <OutputDataTablePath>System\Text\EncodingTable.Data.cs</OutputDataTablePath>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Microsoft\Win32\SafeHandles\SafeAllocHHandle.cs" />
    <Compile Include="System\Text\BaseCodePageEncoding.cs" />
    <Compile Include="System\Text\CodePagesEncodingProvider.cs" />
    <Compile Include="System\Text\DBCSCodePageEncoding.cs" />
    <Compile Include="System\Text\DecoderBestFitFallback.cs" />
    <Compile Include="System\Text\DecoderFallbackBufferHelper.cs" />
    <Compile Include="System\Text\DecoderNLS.cs" />
    <Compile Include="System\Text\EncoderBestFitFallback.cs" />
    <Compile Include="System\Text\EncoderFallbackBufferHelper.cs" />
    <Compile Include="System\Text\EncoderNLS.cs" />
    <Compile Include="System\Text\EncodingByteBuffer.cs" />
    <Compile Include="System\Text\EncodingCharBuffer.cs" />
    <Compile Include="System\Text\EncodingNLS.cs" />
    <Compile Include="System\Text\EncodingTable.cs" />
    <Compile Include="System\Text\EncodingTable.Data.cs" />
    <Compile Include="System\Text\EUCJPEncoding.cs" />
    <Compile Include="System\Text\GB18030Encoding.cs" />
    <Compile Include="System\Text\ISO2022Encoding.cs" />
    <Compile Include="System\Text\ISCIIEncoding.cs" />
    <Compile Include="System\Text\SBCSCodePageEncoding.cs" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows' or '$(TargetFrameworkIdentifier)' == '.NETFramework'">
    <Compile Include="System\Text\CodePagesEncodingProvider.Windows.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs"
             Link="Common\Interop\Windows\Interop.Libraries.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Interop.BOOL.cs"
             Link="Common\Interop\Windows\Interop.BOOL.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetCPInfoEx.cs"
             Link="Common\Interop\Windows\Interop.GetCPInfoEx.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.MAX_PATH.cs"
             Link="Common\Interop\Windows\Interop.MAX_PATH.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WideCharToMultiByte.cs"
             Link="Common\Interop\Windows\Kernel32\Interop.WideCharToMultiByte.cs" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework' and '$(TargetPlatformIdentifier)' != 'windows'">
    <Compile Include="System\Text\CodePagesEncodingProvider.Default.cs" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
    <Compile Include="System\Text\CodePagesEncodingProvider.netcoreapp.cs" />
    <Compile Include="System\Text\BaseCodePageEncoding.netcoreapp.cs" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="Data\codepages.nlp">
      <LogicalName>codepages.nlp</LogicalName>
    </EmbeddedResource>
    <None Include="Data\CodePageNameMappings.csv" />
    <None Include="Data\PreferredCodePageNames.csv" />
  </ItemGroup>

  <ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetCoreAppCurrent)'))">
    <Reference Include="System.Collections" />
    <Reference Include="System.Memory" />
    <Reference Include="System.Runtime" />
    <Reference Include="System.Runtime.InteropServices" />
    <Reference Include="System.Threading" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
    <PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
  </ItemGroup>

</Project>
